<?php

namespace Modules\Admin\Http\Controllers;

use Illuminate\Support\Facades\Request;
use Modules\Admin\Service\FeedbackService;
use Modules\Admin\Service\RoadRescueService;

class FeedbackController extends BaseController
{

	/**
	 *	获取反馈列表
	 *	hinq 2019 08 29
	 *
	 **/
	public function index(){
		$arr_search = (array) Request::all();
		$arr_list = FeedbackService::get_list( (array) $arr_search );
		echo_error($arr_list);
        return view('admin::feedback.index',$arr_list['data']);
	}


	/**
	 *	更新反馈信息状态
	 *	hinq 2019 08 30
	 *
	 **/
	public function update(){
		$arrInput = (array) Request::all();
		return FeedbackService::edit_one( (array) $arrInput );
	}

	/**
	 *  添加反馈信息的处理结果
     *  hinq 2019 11 28
     *
     **/
    public function update_remark(){
        $arr_input = Request::all();
        return FeedbackService::edit_one( (array) $arr_input );
    }



    /**
     *	注册有礼设置
     *	hinq 2019 11 28
     *
     **/
    public function register_gift(){
        //获取所有的优惠券列表
        $arr_list = FeedbackService::get_coupons_list();
        $set_info = FeedbackService::get_register_gift();
        return view('admin::feedback.registerGift',['coupons'=>$arr_list , 'info' => $set_info['data'][0] ]);
    }

    /**
     *  获取平台添加的所有优惠券列表
     *  hinq 2019 11 28
     *
     **/
    public function get_coupons(){
        $arr_list = FeedbackService::get_coupons_list();
        return hello_success('ok', $arr_list );
    }


    /**
     *  添加、更新注册有礼数据
     *  hinq 2019 11 28
     *
     **/
    public function register_gift_update(){

        $arr_input = Request::all();
        return FeedbackService::register_gift_update( (array) $arr_input );
    }

    /**
     *  系统消息列表
     *  hinq 2019 12 07
     *
     **/
    public function message( Request $request ){
        $arr_search = (array) $request::all();
        $arr_list = FeedbackService::get_message( (array) $arr_search );
        echo_error($arr_list);
        return view('admin::feedback.message',$arr_list['data']);
    }


    public function guide( Request $request ){
        $arr_search = (array) Request::all();
        $arr_search['type'] = 5;
        $arr_list = RoadRescueService::get_list_banner( (array) $arr_search );
        echo_error($arr_list);
        return view('admin::feedback.guideBanner',$arr_list['data']);
    }

}